package com.example.dao;

import com.example.entity.Params;
import com.example.entity.Type;
import com.example.entity.dto.InfoDTO;
import com.example.entity.dto.UserDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


@Repository
public interface TypeDao extends Mapper<Type> {

    List<Type> findBySearch(@Param("params") Params params);

    /**
     * 根据学号查找姓名
     * @param studentNumber
     * @return
     */
    @Select("select name from type where number = #{studentNumber}")
    String getNameByNu(String studentNumber);



    List<Type> find1();

    List<Type> find0();
//    @Update("update student set count = count + 1 where name = #{name} and id_card = #{idCard} and number = #{adnumber}")
    @Update("update type set status=1 where id_card=#{idCard}")
    void updataStatusById(UserDTO userDTO);

    @Select("select number ,college,major from type where id_card=#{idCard} ")
    InfoDTO selectInforByIdCard(UserDTO userDTO);

    @Select("select number from type where id_card=#{idCard}")
    String selectNumberByIdCard(String idCard);

    List<Type> findAllType();
}
